<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta content="" name="keywords">

  <title> Blog - </title>
  <meta name="description" content="" />
  <meta property="og:title" content="Blog" />
  <meta name="twitter:title" content="Blog" />
  <meta name="description" content="一个记录学习生活的场所. 大概会有五个方面内容: Thoughts: My thoughts and attitudes about learning everything in life. 思考：我对学习、生活中一切事物的想法和态度。 Critique: My comment, or about technology, or about life, or about something or a movie. 评论：我的评论，或关于技术，或关于生活、或关于某些事情或者一场电影。 Travel: My travel record, of course, may be a business trip haha. 旅行：我的旅行记录，当然可能是出差记录哈哈。 Moment: Some moments that I feel something and eager to write it down. Fragments in my life. Short memos. 片刻：有些时刻我觉得有些东西并且急于把它写下来. 我生命中的碎片 简短的备忘录。 Gallery: Pictures I&rsquo;d like to">
  <meta property="og:description" content="一个记录学习生活的场所. 大概会有五个方面内容: Thoughts: My thoughts and attitudes about learning everything in life. 思考：我对学习、生活中一切事物的想法和态度。 Critique: My comment, or about technology, or about life, or about something or a movie. 评论：我的评论，或关于技术，或关于生活、或关于某些事情或者一场电影。 Travel: My travel record, of course, may be a business trip haha. 旅行：我的旅行记录，当然可能是出差记录哈哈。 Moment: Some moments that I feel something and eager to write it down. Fragments in my life. Short memos. 片刻：有些时刻我觉得有些东西并且急于把它写下来. 我生命中的碎片 简短的备忘录。 Gallery: Pictures I&rsquo;d like to">
  <meta name="twitter:description" content="一个记录学习生活的场所. 大概会有五个方面内容: Thoughts: My thoughts and attitudes about learning everything in life. 思考：我对学习、生活中一切事物的想法和态度。 Critique: My comment, or about technology, or about life, or about something or a …">
  <meta name="author" content="{Description { .Site.Author.name }}"/>
  <meta name="twitter:card" content="summary" />
  <meta property="og:url" content="https://systemime.github.io/blog/" />
  <meta property="og:type" content="website" />
  <meta property="og:site_name" content="听风的小站" />

  <meta name="generator" content="Hugo 0.67.0" />
  <link rel="canonical" href="https://systemime.github.io/blog/" />
  <link rel="alternate" href="https://systemime.github.io/index.xml" type="application/rss+xml" title="听风的小站">
  <script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/jquery-1.12.4.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  
  
  <link rel="stylesheet" href="https://systemime.github.io/css/main.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/my.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/pace.css" />
  <link rel="stylesheet" href="https://cdn.plyr.io/3.4.7/plyr.css">
  <link rel="stylesheet" href="https://systemime.github.io/css/lightgallery.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/baguetteBox.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/search.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/reward.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/share.min.css" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" />
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" />
  <link rel="stylesheet" href="https://systemime.github.io/css/pygment_highlights.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/highlight.min.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/toc.css" />
  <link rel="stylesheet" href="https://systemime.github.io/css/lightbox.css" />
  <link rel="stylesheet" href="https://systemime.github.io/live2d/css/live2d.css" />
  
  <link href="https://systemime.github.io/css/video-js.css" rel="stylesheet">


<meta name="baidu-site-verification" content="g8IYR9SNLF" />
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?cffe439e37449bb1c07ab26ab56484bb";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

<link rel="stylesheet" href="https://systemime.github.io/css/prism.css" />









<script src="https://systemime.github.io/js/pace.min.js" data-no-instant></script>



<script src="https://systemime.github.io/js/instantclick.min.js" data-no-instant></script>
   <script data-no-instant>
   InstantClick.on('change', function(isInitialLoad) {
     if (isInitialLoad === false) {
       if (typeof MathJax !== 'undefined') 
         MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
       if (typeof prettyPrint !== 'undefined') 
         prettyPrint();
       if (typeof _hmt !== 'undefined')  
         _hmt.push(['_trackPageview', location.pathname + location.search]);
       if (typeof ga !== 'undefined')  
           ga('send', 'pageview', location.pathname + location.search);
     }
   });
   InstantClick.init();
</script>




<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.7.1/gist-embed.min.js"></script>


<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-3925981084585036",
    enable_page_level_ads: true
  });
</script>



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/photoswipe.min.css" integrity="sha256-sCl5PUOGMLfFYctzDW3MtRib0ctyUvI9Qsmq2wXOeBY=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.1/default-skin/default-skin.min.css" integrity="sha256-BFeI1V+Vh1Rk37wswuOYn5lsTcaU96hGaI7OUVCLjPc=" crossorigin="anonymous" />



<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

<div class="pswp__bg"></div>

<div class="pswp__scroll-wrap">
    
    <div class="pswp__container">
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
    </div>
    
    <div class="pswp__ui pswp__ui--hidden">
    <div class="pswp__top-bar">
      
      <div class="pswp__counter"></div>
      <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
      <button class="pswp__button pswp__button--share" title="Share"></button>
      <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
      <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
      
      
      <div class="pswp__preloader">
        <div class="pswp__preloader__icn">
          <div class="pswp__preloader__cut">
            <div class="pswp__preloader__donut"></div>
          </div>
        </div>
      </div>
    </div>
    <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
      <div class="pswp__share-tooltip"></div>
    </div>
    <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
    </button>
    <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
    </button>
    <div class="pswp__caption">
      <div class="pswp__caption__center"></div>
    </div>
    </div>
    </div>
</div>

</head>

  <body>
    <nav class="navbar navbar-default navbar-fixed-top navbar-custom">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="https://systemime.github.io">听风的小站</a>
    </div>
    <div class="collapse navbar-collapse" id="main-navbar">
      <ul class="nav navbar-nav navbar-right">
        
          
            <li>
		    <a title="博客" href="https://systemime.github.io/blog/">博客</a>
              
              
            </li>
          
        
          
            <li>
		    <a title="片刻" href="https://systemime.github.io/moment/">片刻</a>
              
              
            </li>
          
        
          
            <li>
		    <a title="关于" href="https://systemime.github.io/about/">关于</a>
              
              
            </li>
          
        
          
            <li>
		    <a title="留言" href="https://systemime.github.io/message/">留言</a>
              
              
            </li>
          
        

        

        
        
      </ul>
    </div>

    <div class="avatar-container">
      <div class="avatar-img-border">
        
      </div>
    </div>

  </div>
</nav>






    
  <header class="header-section ">
    <div class="intro-header no-img">
      <div class="container">
        <div class="row">
          <div class="col-lg-12 col-md-12 col-md-offset-0">
            <div class="page-heading">
              <h1>Blog</h1>
              <hr class="small">
            </div>
          </div>
        </div>
      </div>
    </div>
  </header>

    
  <div class="container" role="main">
    <div class="row">
      <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
        
          <div class="well">
            <p>一个记录学习生活的场所. 大概会有五个方面内容:</p>
<hr>
<ul>
<li>Thoughts: My thoughts and attitudes about learning everything in life.<br>
<!-- raw HTML omitted -->思考：我对学习、生活中一切事物的想法和态度。<!-- raw HTML omitted --></li>
<li>Critique: My comment, or about technology, or about life, or about something or a movie.<br>
<!-- raw HTML omitted -->评论：我的评论，或关于技术，或关于生活、或关于某些事情或者一场电影。<!-- raw HTML omitted --></li>
<li>Travel: My travel record, of course, may be a business trip haha.<br>
<!-- raw HTML omitted -->旅行：我的旅行记录，当然可能是出差记录哈哈。<!-- raw HTML omitted --></li>
<li>Moment: Some moments that I feel something and eager to write it down. Fragments in my life. Short memos.
<!-- raw HTML omitted --><!-- raw HTML omitted -->片刻：有些时刻我觉得有些东西并且急于把它写下来. 我生命中的碎片 简短的备忘录。<!-- raw HTML omitted --></li>
<li>Gallery: Pictures I&rsquo;d like to share. My favourite ones.
<!-- raw HTML omitted --><!-- raw HTML omitted -->画廊：我想分享的图片. 我最喜欢的。<!-- raw HTML omitted --></li>
</ul>
<p>博客无序，随需随记</p>

          </div>
        
        <div class="posts-list">
          
            <article class="post-preview">
              <a href="https://systemime.github.io/blog/2019-08/linux-%E4%B8%80%E6%AC%A1%E6%80%A7%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1-at/">
                <h2 class="post-title">Linux 一次性定时任务 —— at</h2>

                
              </a>

              <p class="post-meta">
                Posted on August 18, 2019
              </p>
              <div class="post-entry">
                
                  <h2 id="一检查服务">一、检查服务</h2>
<ul>
<li>检查服务是否安装</li>
</ul>
<pre><code># centos6 及Ubuntu
chkconfig --list | grep atd
# centos7 
systemctl list-unit-files |grep atd
</code></pre><p>在centos7中输出:</p>
<pre><code>[cc@user ~]$ systemctl list-unit-files |grep atd  
atd.service                                         enabled  
rpc-statd-notify.service                      static  
rpc-statd.service                                 static  
</code></pre><ul>
<li>检查服务是否启动
上一步检查中，<code>atd.service</code>后面对应enadble表示开机自启，现在再检查一遍是否启动成功</li>
</ul>
<pre><code># centos6
service atd status
# centos7 
[cc@user ~]$ systemctl status atd
● atd.service - Job spooling tools
   Loaded: loaded (/usr/lib/systemd/system/atd.service; enabled; vendor preset: enabled)
   Active: active (running) since 五 2019-08-16 10:56:16 CST; 3 days ago
 Main PID: 1430 (atd)
   CGroup: /system.slice/atd.service
           └─1430 /usr/sbin/atd -f

8月 16 10:56:16 qifeng systemd[1]: Started Job spooling tools.
8月 16 10:56:16 qifeng systemd[1]: Starting Job spooling tools...

# 设置自启
systemctl enabled atd
</code></pre><h2 id="二at简单介绍">二、at简单介绍</h2>
<h4 id="1-黑白名单">1. 黑白名单</h4>
<p>在系统的 <code>/etc</code> 目录下可能会有两个关于 <strong>at</strong>命令使用限制的文件，一个是黑名单(<code>etc/at/deny</code>)一个是白名单（<code>/etc/at.allow</code>），一般只有一个黑名单文件，因为大部分情况下是允许执行 at 命令的，当然可以根据具体情况设置黑白名单.</p>
<ol>
<li>如果系统中有<code>/etc/at.allow </code>文件，那么只有被写入该文件的用户才可以执行 at 命令,相当于白名单文件<br>
此时<code>/etc/at.deny</code>就会被忽略，相当于黑名单。</li>
<li>如果系统中没有<code>/etc/at.allow</code>文件，只有<code>/etc/at.deny</code>，那么被写入该文件的用户就不能使用 at 命令<br>
黑名单对 root 不起作用。</li>
<li>如果两个文件都不存在，那么只有root 用户可以执行。</li>
</ol>
<h4 id="2-at命令说明">2. at命令说明</h4>
<blockquote>
<p>at [参数] [时间格式]</p>
</blockquote>
<p><strong>参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>意义</th>
</tr>
</thead>
<tbody>
<tr>
<td>m</td>
<td>当指定的任务被完成之后，将给用户发送邮件，即使没有标准输出</td>
</tr>
<tr>
<td>I</td>
<td>atq的别名</td>
</tr>
<tr>
<td>d</td>
<td>atrm的别名</td>
</tr>
<tr>
<td>v</td>
<td>显示任务将被执行的时间</td>
</tr>
<tr>
<td>c</td>
<td>打印任务的内容到标准输出</td>
</tr>
<tr>
<td>V</td>
<td>显示版本信息</td>
</tr>
<tr>
<td>q</td>
<td>&lt;列队&gt; 使用指定的列队</td>
</tr>
<tr>
<td>f</td>
<td>&lt;文件&gt; 从指定文件读入任务而不是从标准输入读入</td>
</tr>
<tr>
<td>t</td>
<td>&lt;时间参数&gt; 以时间参数的形式提交要运行的任务</td>
</tr>
</tbody>
</table>
<h4 id="3-时间格式">3. 时间格式</h4>
<p>at 允许使用一套相当复杂的指定时间的方法。</p>
<p>他能够接受在当天的hh:mm（小时:分钟）式的时间指定。</p>
<p>假如该时间已过去，那么就放在第二天执行。当然也能够使用midnight（深夜），noon（中午），teatime（饮茶时间，一般是下午4点）等比较模糊的 词语来指定时间。</p>
<p>用户还能够采用12小时计时制，即在时间后面加上AM（上午）或PM（下午）来说明是上午还是下午。 也能够指定命令执行的具体日期，指定格式为month day（月 日）或mm/dd/yy（月/日/年）或 dd.mm.yy（日.月.年）。指定的日期必须跟在指定时间的后面。</p>
<p>上面介绍的都是绝对计时法，其实还能够使用相对计时法，这对于安排不久就要执行的命令是很有好处的。</p>
<p>指定格式为：now + count time-units ，now就是当前时间，time-units是时间单位，这里能够是minutes（分钟）、hours（小时）、days（天）、weeks（星期）。</p>
<p>count是时间的数量，究竟是几天，还是几小时，等等。</p>
<p>更有一种计时方法就是直接使用today（今天）、tomorrow（明天）来指定完成命令的时间。</p>
<p><strong>一些例子</strong></p>
<ul>
<li>准时</li>
</ul>
<table>
<thead>
<tr>
<th>格式</th>
<th>代表实例</th>
</tr>
</thead>
<tbody>
<tr>
<td>HH:MM</td>
<td>at 02:30</td>
</tr>
<tr>
<td>HH:MM YYYY-MM-DD</td>
<td>at 8:00 2020-01-01</td>
</tr>
<tr>
<td>HH:MM [am/pm] [month] [date]</td>
<td>at 8:00 Oct 1 # 在十月一号的八点</td>
</tr>
<tr>
<td>HHlMM [am/pm] + number [minutes</td>
<td>hours</td>
</tr>
<tr>
<td>now + 时间</td>
<td>如在十分钟后：at now + 10 minutes，在一天后：at now + 1 days</td>
</tr>
</tbody>
</table>
<ul>
<li>超时</li>
</ul>
<table>
<thead>
<tr>
<th>格式</th>
<th>用法</th>
<th>含义</th>
</tr>
</thead>
<tbody>
<tr>
<td>HH:MM</td>
<td>ex&gt; 04:00</td>
<td>在今日的 HH:MM 时刻进行，若该时刻已超过，则明天的 HH:MM 进行此任务</td>
</tr>
<tr>
<td>HH:MM YYYY-MM-DD</td>
<td>ex&gt; 04:00 2009-03-17</td>
<td>强制规定在某年某月的某一天的特殊时刻进行该项任务</td>
</tr>
<tr>
<td>HH:MM[am/pm] [Month] [Date]</td>
<td>ex&gt; 04pm March 17</td>
<td>也是一样，强制在某年某月某日的某时刻进行该项任务</td>
</tr>
<tr>
<td>HH:MM[am/pm] + number [minutes</td>
<td>hours</td>
<td>days</td>
</tr>
</tbody>
</table>
<h2 id="三使用实例">三、使用实例</h2>
<h4 id="1-完整使用步骤">1. 完整使用步骤</h4>
<p>创建一个脚本文件hello.sh，在根目录下创建一个文件at.txt，并写入hello</p>
<pre><code>#!/bin/bash
touch at.txt
echo &quot;hello&quot; &gt; /at.txt
</code></pre><p>现在需要使用at 命令设定在5分钟后执行该脚本文件：</p>
<pre><code>[root@www /]# at now + 5 minutes
at&gt; /hello.sh
at&gt; &lt;EOT&gt;   # 在输入命令后 按 ctrl +ｄ　结束输入，并提示我们 此任务编号为7
job 7 at 2017-07-08 19:15  
[root@www /]#
</code></pre><p>然后查看所有　at　任务，可以看到刚才添加的 7 号任务：</p>
<pre><code>[root@www /]# at -l
5   2017-10-01 08:00 a root
7   2017-07-08 19:15 a root
6   2017-07-09 19:01 a root
[root@www /]#
</code></pre><p>查看 7 号任务的详情：</p>
<pre><code> [root@www /]# at -c 7
#!/bin/sh
# atrun uid=0 gid=0
...
...
...
# 省略一大堆系统设置的变量
${SHELL:-/bin/sh} &lt;&lt; 'marcinDELIMITER1585a268'
/hello.sh # 这就是我们要执行的命令

marcinDELIMITER1585a268
[root@www /]#
</code></pre><p>删除 7 号命令，再次查看已经被删除：</p>
<pre><code>[root@www /]# at -d 7
[root@www /]# at -l
5   2017-10-01 08:00 a root
6   2017-07-09 19:01 a root
[root@www /]#
</code></pre><h4 id="2-其他实例使用">2. 其他实例使用</h4>
<table>
<thead>
<tr>
<th>要求</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>三天后的下午5点执行 /bin/ls</td>
<td>at 5pm+3 days</td>
</tr>
</tbody>
</table>
<p><strong>输出</strong></p>
<pre><code>[root@localhost ~]# at 5pm+3 days
at&gt; /bin/ls
at&gt; &lt;EOT&gt;
job 7 at 2013-01-08 17:00
[root@localhost ~]#
</code></pre><table>
<thead>
<tr>
<th>要求</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>明天17点钟，输出时间到指定文件内</td>
<td>at 17:20 tomorrow</td>
</tr>
</tbody>
</table>
<p><strong>输出</strong></p>
<pre><code>[root@localhost ~]# at 17:20 tomorrow
at&gt; date &gt;/root/2013.log 
at&gt; &lt;EOT&gt;
job 8 at 2013-01-06 17:20
[root@localhost ~]#
</code></pre><table>
<thead>
<tr>
<th>要求</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>计划任务设定后，在没有执行之前我们可以用atq命令来查看系统没有执行工作任务</td>
<td>atq</td>
</tr>
</tbody>
</table>
<p><strong>输出</strong></p>
<pre><code>[root@localhost ~]# atq
8 2013-01-06 17:20 a root
7 2013-01-08 17:00 a root
[root@localhost ~]#
</code></pre><table>
<thead>
<tr>
<th>要求</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>删除已经设置的任务</td>
<td>atrm 7</td>
</tr>
</tbody>
</table>
<p><strong>输出</strong></p>
<pre><code>[root@localhost ~]# atq
8 2013-01-06 17:20 a root
7 2013-01-08 17:00 a root
[root@localhost ~]# atrm 7
[root@localhost ~]# atq
8 2013-01-06 17:20 a root
[root@localhost ~]#
</code></pre><table>
<thead>
<tr>
<th>要求</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>显示已经设置的任务内容</td>
<td>at -c 8</td>
</tr>
</tbody>
</table>
<p><strong>输出</strong></p>
<pre><code>[root@localhost ~]# at -c 8
#!/bin/sh
# atrun uid=0 gid=0
# mail root 0
umask 22此处省略n个字符
date &gt;/root/2013.log
[root@localhost ~]#
</code></pre>
                
              </div>

              
                <span class="post-meta">
                  
                    #<a href="https://systemime.github.iotags/linux/">Linux</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/at/">at</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/%E5%AE%9A%E6%97%B6/">定时</a>&nbsp;
                  
                </span>
              

            </article>
          
            <article class="post-preview">
              <a href="https://systemime.github.io/blog/2019-08/%E5%9F%BA%E4%BA%8Enginx%E9%83%A8%E7%BD%B2django/">
                <h2 class="post-title">基于Nginx部署Django</h2>

                
              </a>

              <p class="post-meta">
                Posted on August 15, 2019
              </p>
              <div class="post-entry">
                
                  <h2 id="一部署原理">一、部署原理</h2>
<p>Django的部署可以有很多方式，采用nginx+uwsgi的方式是其中比较常见的一种方式。</p>
<p>在这种方式中，我们的通常做法是，将nginx作为服务器最前端，它将接收WEB的所有请求，统一管理请求。</p>
<p>nginx把所有静态请求自己来处理（这是NGINX的强项）。然后，NGINX将所有非静态请求通过uwsgi传递给Django，由Django来进行处理，从而完成一次WEB请求。</p>
<p>可见，uwsgi的作用就类似一个桥接器。起到桥梁的作用。</p>
<h2 id="二nginx安装">二、Nginx安装</h2>
<p><code>Nginx</code>是一款轻量级的Web服务器/反向代理服务器及电子邮件（IMAP/POP3）代理服务器，并在一个BSD-like 协议下发行。其特点是占有内存少，并发能力强，事实上nginx的并发能力确实在同类型的网页服务器中表现较好。</p>
<p>Nginx同样为当前非常流行的web服务器。利用其部署Django，我们在此也做简单的介绍。</p>
<p>Nginx官网：<a href="http://nginx.org/">http://nginx.org/</a></p>
<ul>
<li>在终端下安装<strong>nginx</strong></li>
</ul>
<pre><code>apt-get install nginx
</code></pre><ul>
<li>启动<strong>nginx</strong></li>
</ul>
<pre><code>/etc/init.d/nginx start  #启动
/etc/init.d/nginx stop  #关闭
/etc/init.d/nginx restart  #重启
# 或
systemctl start/stop/restart nginx
</code></pre><ul>
<li>修改Nginx默认端口号，打开 <code>/etc/nginx/nginx.conf</code> 文件，修改端口号。</li>
</ul>
<pre><code># 这里我的端口号为9000，默认为80
# server_name修改为0.0.0.0

    server {
        listen       9000 default_server;
        listen       [::]:80 default_server;
        server_name  0.0.0.0;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:8000;
            uwsgi_read_timeout 5;
        }

        location /static {
            expires 30d;
            autoindex on;
            add_header Cache-Control private;
            alias /opt/bloe/mbl/liuyanban2/static/;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
</code></pre><ul>
<li>
<p>重启nginx
重启nginx，访问<a href="http://%E5%A4%96%E7%BD%91IP:9000">http://外网IP:9000</a></p>
<p>比如像下面这样<br>
<img src="" alt="实例"></p>
<p>出现上图说明启动成功</p>
</li>
</ul>
<h2 id="三安装uwsgi">三、安装uwsgi</h2>
<ul>
<li>pip安装uwsgi</li>
</ul>
<pre><code>pip install uwsgi
</code></pre><ul>
<li>
<p>配置django与uwsgi连接，假设项目位置为：<code>/home/fnngj/pydj/myweb</code></p>
<pre><code>uwsgi --http :8001 --chdir /opt/bloe/mbl/liuyanban2/ --wsgi-file liuyanban2/wsgi.py --master --processes 4 --threads 2 --stats 0.0.0.0:60013
</code></pre><pre><code>
 最后的`0.0.0.0:60013` 表示外网，端口号自定义

</code></pre></li>
<li>
<p><strong>常用选项</strong></p>
<ul>
<li>
<p><code>http</code>： 协议类型和端口号</p>
</li>
<li>
<p><code>processes</code>： 开启的进程数量</p>
</li>
<li>
<p><code>workers</code>： 开启的进程数量，等同于processes（官网的说法是spawn the specified number ofworkers / processes）</p>
</li>
<li>
<p><code>chdir</code>： 指定运行目录（chdir to specified directory before apps loading）</p>
</li>
<li>
<p><code>wsgi-file</code>： 载入wsgi-file（load .wsgi file）</p>
</li>
<li>
<p><code>stats</code>： 在指定的地址上，开启状态服务（enable the stats server on the specified address）</p>
</li>
<li>
<p><code>threads</code>： 运行线程。由于GIL的存在，我觉得这个真心没啥用。（run each worker in prethreaded mode with the specified number of threads）</p>
</li>
<li>
<p><code>master</code>： 允许主进程存在（enable master process）</p>
</li>
<li>
<p><code>daemonize</code>： 使进程在后台运行，并将日志打到指定的日志文件或者udp服务器（daemonize uWSGI）。实际上最常用的，还是把运行记录输出到一个本地文件上。</p>
</li>
<li>
<p><code>pidfile</code>： 指定pid文件的位置，记录主进程的pid号。</p>
</li>
<li>
<p><code>vacuum</code>： 当服务器退出的时候自动清理环境，删除unix socket文件和pid文件（try to remove all of the generated file/sockets）</p>
</li>
</ul>
</li>
</ul>
<h2 id="四nginxuwsgidjango">四、Nginx+uwsgi+Django</h2>
<h4 id="1-配置wsgi">1. 配置wsgi</h4>
<p>工程项目文件目录树如下</p>
<pre><code>myweb/

├── manage.py

├── myweb/

│   ├── __init__.py

│   ├── settings.py

│   ├── urls.py

│   └── wsgi.py

└── myweb_uwsgi.ini
</code></pre><p>在我们通过Django创建myweb项目时，在子目录myweb下已经帮我们生成的 <code>wsgi.py</code>文件。</p>
<p>所以，我们只需要再创建<code>myweb_uwsgi.ini</code>配置文件即可，当然，uwsgi支持多种类型的配置文件，如xml，ini等。此处，使用ini类型的配置。</p>
<p><strong>注意，myweb是项目名</strong></p>
<pre><code># myweb_uwsgi.ini file
[uwsgi]

# Django-related settings

socket = :8000

# the base directory (full path)
# 项目位置
chdir           = /opt/bloe/mbl/liuyanban2

# Django s wsgi file
module          = liuyanban2.wsgi

# process-related settings
# master
master          = true

# maximum number of worker processes
processes       = 4

# ... with appropriate permissions - may be needed
# chmod-socket    = 664
# clear environment on exit
vacuum          = true
</code></pre><ul>
<li>
<p>socket  指定项目执行的端口号。</p>
</li>
<li>
<p>chdir   指定项目的目录。</p>
</li>
<li>
<p>module  myweb.wsgi ，可以这么来理解，对于myweb_uwsgi.ini文件来说，与它的平级的有一个myweb目录，这个目录下有一个wsgi.py文件。</p>
</li>
</ul>
<h4 id="2-测试uwsgi">2. 测试uwsgi</h4>
<p>接下来，切换到myweb项目目录下，通过uwsgi命令读取myweb_uwsgi.ini文件启动项目</p>
<pre><code>user@ubuntu:~$ cd /home/fnngj/pydj/myweb/
user@ubuntu:~/pydj/myweb$ uwsgi --ini myweb_uwsgi.ini 
[uWSGI] getting INI configuration from myweb_uwsgi.ini
*** Starting uWSGI 2.0.12 (32bit) on [Sat Mar 12 13:05:06 2016] ***
compiled with version: 4.8.4 on 26 January 2016 06:14:41
os: Linux-3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:18:00 UTC 2015
nodename: ubuntu
machine: i686
clock source: unix
detected number of CPU cores: 2
current working directory: /home/fnngj/pydj/myweb
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /home/fnngj/pydj/myweb
your processes number limit is 15962
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :8000 fd 3
Python version: 3.4.3 (default, Oct 14 2015, 20:37:06)  [GCC 4.8.4]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x8b52dc0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 319920 bytes (312 KB) for 4 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x8b52dc0 pid: 7158 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 7158)
spawned uWSGI worker 1 (pid: 7160, cores: 1)
spawned uWSGI worker 2 (pid: 7161, cores: 1)
spawned uWSGI worker 3 (pid: 7162, cores: 1)
spawned uWSGI worker 4 (pid: 7163, cores: 1)
</code></pre><h4 id="3-配置nginx">3. 配置nginx</h4>
<p>修改nginx.conf配置文件。打开/etc/nginx/nginx.conf文件，添加如下内容。</p>
<pre><code>server {
        listen       9000 default_server;
        listen       [::]:80 default_server;
        server_name  0.0.0.0;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:8000;
            uwsgi_read_timeout 5;
        }

        location /static {
            expires 30d;
            autoindex on;
            add_header Cache-Control private;
            alias /opt/bloe/mbl/liuyanban2/static/;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

</code></pre><p>实际前面几步中已经添加了</p>
<ul>
<li>
<p><code>listen</code> 指定的是nginx代理uwsgi对外的端口号。</p>
</li>
<li>
<p><code>server_name</code>  网上大多资料都是设置的一个网址（例，www.example.com），我这里如果设置成网址无法访问，所以，指定的到了本机默认ip，当然可以0.0.0.0，外网访问</p>
</li>
<li>
<p><code>include</code> 必须指定为<strong>uwsgi_params</strong>；而<code>uwsgi_pass</code>指的本机IP的端口号与<strong>myweb_uwsgi.ini</strong>配置中的文件中的必须一致。</p>
</li>
</ul>
<h4 id="4-测试nginx">4. 测试nginx</h4>
<p>现在重新启动nginx，翻看上面重启动nginx的命令。然后，访问：<a href="http://%E5%A4%96%E7%BD%91IP:9000/">http://外网IP:9000/</a></p>
<p>通过这个IP和端口号的指向，请求应该是先到nginx的。如果你在页面上执行一些请求，就会看到，这些请求最终会转到uwsgi来处理。</p>
<h2 id="五结束">五、结束</h2>

                
              </div>

              
                <span class="post-meta">
                  
                    #<a href="https://systemime.github.iotags/django/">Django</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/nginx/">Nginx</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/uwsgi/">uwsgi</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/%E9%83%A8%E7%BD%B2/">部署</a>&nbsp;
                  
                </span>
              

            </article>
          
            <article class="post-preview">
              <a href="https://systemime.github.io/blog/2019-08/centos7.4%E4%B8%ADiptables%E5%92%8Cfirewalld%E7%9A%84%E4%B8%80%E4%BA%9B%E6%93%8D%E4%BD%9C/">
                <h2 class="post-title">Centos7.4中iptables和firewalld的一些操作</h2>

                
              </a>

              <p class="post-meta">
                Posted on August 5, 2019
              </p>
              <div class="post-entry">
                
                  <h2 id="一firewalld的基本使用">一、firewalld的基本使用</h2>
<h4 id="1启动">1.启动</h4>
<pre><code>systemctl start firewalld
</code></pre><h4 id="2查看状态">2.查看状态</h4>
<pre><code>systemctl status firewalld 
</code></pre><h4 id="3停止">3.停止</h4>
<pre><code>systemctl stop firewalld
</code></pre><h4 id="4禁自启">4.禁自启</h4>
<pre><code>systemctl disable firewalld
</code></pre><h2 id="二配置firewalld-cmd">二、配置firewalld-cmd</h2>
<h4 id="1查看版本">1.查看版本</h4>
<pre><code>firewall-cmd --version
</code></pre><h4 id="2查看帮助">2.查看帮助</h4>
<pre><code>firewall-cmd --help
</code></pre><h4 id="3显示状态">3.显示状态</h4>
<pre><code>firewall-cmd --state
</code></pre><h4 id="4查看所有打开的端口">4.查看所有打开的端口</h4>
<pre><code>firewall-cmd--zone=public --list-ports
</code></pre><h4 id="5更新防火墙规则">5.更新防火墙规则</h4>
<pre><code>firewall-cmd --reload
</code></pre><h4 id="6查看区域信息">6.查看区域信息</h4>
<pre><code>firewall-cmd--get-active-zones
</code></pre><h4 id="7查看指定接口所属区域">7.查看指定接口所属区域</h4>
<pre><code>firewall-cmd--get-zone-of-interface=eth0
</code></pre><h4 id="8拒绝所有包">8.拒绝所有包</h4>
<pre><code>firewall-cmd --panic-on
</code></pre><h4 id="9取消拒绝状态">9.取消拒绝状态</h4>
<pre><code>firewall-cmd --panic-off
</code></pre><h4 id="10查看是否拒绝">10.查看是否拒绝</h4>
<pre><code>firewall-cmd --query-panic
</code></pre><h2 id="三firewalld开启端口">三、firewalld开启端口</h2>
<h4 id="1添加">1.添加</h4>
<pre><code>firewall-cmd --zone=public --add-port=80/tcp --permanent   （--permanent永久生效，没有此参数重启后失效）
</code></pre><h4 id="2重新载入">2.重新载入</h4>
<pre><code>firewall-cmd --reload
</code></pre><h4 id="3查看">3.查看</h4>
<pre><code>firewall-cmd --zone=public --query-port=80/tcp
</code></pre><h4 id="4删除">4.删除</h4>
<pre><code>firewall-cmd --zone=public --remove-port=80/tcp --permanent
</code></pre><h4 id="5查看firewall是否运行下面两个命令都可以">5.查看firewall是否运行,下面两个命令都可以</h4>
<pre><code>systemctl status firewalld.service

firewall-cmd --state
</code></pre><h4 id="6查看当前开了哪些端口">6.查看当前开了哪些端口</h4>
<pre><code># 其实一个服务对应一个端口，每个服务对应/usr/lib/firewalld/services下面一个xml文件。

firewall-cmd --list-services
</code></pre><h4 id="7查看还有哪些服务可以打开">7.查看还有哪些服务可以打开</h4>
<pre><code>firewall-cmd --get-services
</code></pre><h4 id="8查看所有打开的端口">8.查看所有打开的端口：</h4>
<pre><code>firewall-cmd --zone=public --list-ports
</code></pre><h4 id="9更新防火墙规则">9.更新防火墙规则：</h4>
<pre><code>firewall-cmd --reload
</code></pre><h2 id="三iptables基本使用">三、iptables基本使用</h2>
<h4 id="1安装">1.安装</h4>
<pre><code>yum install iptables-services
</code></pre><h4 id="2配置">2.配置</h4>
<h4 id="3自启">3.自启</h4>
<pre><code># centos7 及以上
systemctl enable iptables

# centos6 及以前
chkconfig iptables on
</code></pre><h4 id="4防火墙配置修改">4.防火墙配置修改</h4>
<ul>
<li>
<p>以开启Redis端口为例</p>
<pre><code>vim /etc/sysconfig/iptables
</code></pre><pre><code>
</code></pre></li>
<li>
<p>添加配置</p>
<pre><code> -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT

 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6379:7000 -j ACCEPT  //开放6379到7000之间的端口
</code></pre><pre><code>
</code></pre></li>
<li>
<p>重启并保存</p>
<pre><code>service iptables save

service iptables restart 
</code></pre><pre><code>







































</code></pre></li>
</ul>

                
              </div>

              
                <span class="post-meta">
                  
                    #<a href="https://systemime.github.iotags/linux/">Linux</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/%E9%98%B2%E7%81%AB%E5%A2%99/">防火墙</a>&nbsp;
                  
                </span>
              

            </article>
          
            <article class="post-preview">
              <a href="https://systemime.github.io/blog/2019-08/django%E8%A7%A3%E5%86%B3%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/">
                <h2 class="post-title">Django解决跨域问题</h2>

                
              </a>

              <p class="post-meta">
                Posted on August 5, 2019
              </p>
              <div class="post-entry">
                
                  <h2 id="一错误提示">一、错误提示</h2>
<pre><code>No 'Access-Control-Allow-Origin' header is present on the requested resource.
</code></pre><h3 id="什么是cors">什么是CORS</h3>
<p>上面的问题就是由<code>CORS</code>引起的，什么是CORS?<br>
CORS（跨域资源共享，Cross-Origin Resource Sharing）是一种跨域访问的机制，可以让Ajax实现跨域访问。<br>
其实，在服务器的response header中，加入 &quot; Access-Control-Allow-Origin: *&rdquo; 即可支持CORS</p>
<h2 id="二跨域方案">二、跨域方案</h2>
<h3 id="1使用jsonp">1、使用JSONP</h3>
<p>使用Ajax获取json数据时，存在跨域的限制。</p>
<p>不过，在Web页面上调用js的script脚本文件时却不受跨域的影响，JSONP就是利用这个来实现跨域的传输。</p>
<p>因此，我们需要将Ajax调用中的dataType从JSON改为JSONP（相应的API也需要支持JSONP）格式。</p>
<p><strong>JSONP只能用于GET请求。</strong></p>
<h3 id="2直接修改django中的viewspy文件">2、直接修改Django中的views.py文件</h3>
<p>修改views.py中对应API的实现函数，允许其他域通过Ajax请求数据：
<div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class="k">def</span> <span class="nf">myview</span><span class="p">(</span><span class="n">_request</span><span class="p">):</span>
  <span class="n">response</span> <span class="o">=</span> <span class="n">HttpResponse</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">({</span><span class="s2">&#34;key&#34;</span><span class="p">:</span> <span class="s2">&#34;value&#34;</span><span class="p">,</span> <span class="s2">&#34;key2&#34;</span><span class="p">:</span> <span class="s2">&#34;value&#34;</span><span class="p">}))</span>
  <span class="n">response</span><span class="p">[</span><span class="s2">&#34;Access-Control-Allow-Origin&#34;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&#34;*&#34;</span>
  <span class="n">response</span><span class="p">[</span><span class="s2">&#34;Access-Control-Allow-Methods&#34;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&#34;POST, GET, OPTIONS&#34;</span>
  <span class="n">response</span><span class="p">[</span><span class="s2">&#34;Access-Control-Max-Age&#34;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&#34;1000&#34;</span>
  <span class="n">response</span><span class="p">[</span><span class="s2">&#34;Access-Control-Allow-Headers&#34;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&#34;*&#34;</span>
  <span class="k">return</span> <span class="n">response</span></code></pre></div></p>
<h3 id="3安装django-cors-headers">3、安装django-cors-headers</h3>
<p>来自GitHub的库，<a href="https://github.com/ottoyiu/django-cors-headers/">django-cors-headers</a></p>
<p>用于处理跨源资源共享（CORS）所需的服务器头的Django应用程序</p>
<p>使用之前要注意一下使用范围：
* 支持Python 3.5-3.7
* Django 1.11-2.2支持</p>
<p>安装django-cors-headers：</p>
<pre><code>pip install django-cors-headers
</code></pre><p>必要的添加，在<code>setting.py</code>文件中</p>
<pre><code>INSTALLED_APPS = (
  ...
  'corsheaders',
  ...
)
 
...
 
MIDDLEWARE_CLASSES = (
  ...
  'corsheaders.middleware.CorsMiddleware',
  'django.middleware.common.CommonMiddleware',
  ...
)
</code></pre><p>分享一下个人的其他配置(如果有安全性考虑请不要照抄，尤其是第一行&hellip;.)，具体请看GitHub官方配置页</p>
<pre><code># 跨域设置
CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = []
CORS_ALLOW_METHODS = [
    ' DELETE ',
    ' GET ',
    ' OPTIONS ',
    ' PATCH ',
    ' POST ',
    ' PUT ',
]
CORS_ALLOW_HEADERS = [
    'accept',
    'accept-encoding',
    'authorization',
    'content-type',
    'dnt',
    'origin',
    'user-agent',
    'x-csrftoken',
    'x-requested-with',
]
CORS_ALLOW_CREDENTIALS = True

X_FRAME_OPTIONS = 'ALLOWALL'

SECURE_HSTS_SECONDS = 3600
</code></pre><h2 id="ajax提交的小教程">ajax提交的小教程</h2>
<p><a href="https://www.cnblogs.com/wj-1314/p/10539203.html">https://www.cnblogs.com/wj-1314/p/10539203.html</a></p>

                
              </div>

              
                <span class="post-meta">
                  
                    #<a href="https://systemime.github.iotags/django/">Django</a>&nbsp;
                  
                    #<a href="https://systemime.github.iotags/%E8%B7%A8%E5%9F%9F/">跨域</a>&nbsp;
                  
                </span>
              

            </article>
          
        </div>
        
          <ul class="pager main-pager">
            
              <li class="previous">
                <a href="https://systemime.github.io/blog/page/1">&larr; Newer Posts</a>
              </li>
            
            
              <li class="next">
                <a href="https://systemime.github.io/blog/page/3">Older Posts &rarr;</a>
              </li>
            
          </ul>
        
      </div>
    <div align="center" class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
        

<ul class="pagination">
    
    <li class="page-item">
        <a href="https://systemime.github.io/blog/" class="page-link" aria-label="First"><span aria-hidden="true">&laquo;&laquo;</span></a>
    </li>
    
    <li class="page-item">
    <a href="https://systemime.github.io/blog/" class="page-link" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
    </li>
    
    
    
    
    
    
    
        
        
    
    
    <li class="page-item"><a class="page-link" href="https://systemime.github.io/blog/">1</a></li>
    
    
    
    
    
    
        
        
    
    
    <li class="page-item active"><a class="page-link" href="https://systemime.github.io/blog/page/2/">2</a></li>
    
    
    
    
    
    
        
        
    
    
    <li class="page-item"><a class="page-link" href="https://systemime.github.io/blog/page/3/">3</a></li>
    
    
    
    
    
    
        
        
    
    
    <li class="page-item disabled"><span aria-hidden="true">&nbsp;&hellip;&nbsp;</span></li>
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    
    
    
    
    
        
        
    
    
    <li class="page-item"><a class="page-link" href="https://systemime.github.io/blog/page/18/">18</a></li>
    
    
    <li class="page-item">
    <a href="https://systemime.github.io/blog/page/3/" class="page-link" aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
    </li>
    
    <li class="page-item">
        <a href="https://systemime.github.io/blog/page/18/" class="page-link" aria-label="Last"><span aria-hidden="true">&raquo;&raquo;</span></a>
    </li>
    
</ul>


        
        
        
        
        
      </div>
    </div>
  </div>

    <div class="rocket"><img src="https://systemime.github.io/img/rocket_up.png" alt="" width="100" height="100"></div>
<script>
    $(function () {
      $(window).scroll(function () {
        
        if ($(window).scrollTop() >= 1000) {
          $('.rocket').stop().fadeIn(1000);
        }else {
          $('.rocket').stop().fadeOut(1000);
        }
      })
      
      $('.rocket').click(function () {
        $('html,body').stop().animate({scrollTop:0},400);
       
      })
    })

</script>

    
    <div id="landlord">
        <div class="message" style="opacity:0"></div>
        <canvas id="live2d" width="280" height="250" class="live2d"></canvas>
        <div class="hide-button">隐藏</div>
    </div>
    
    <footer id="copyright">
  <div class="container">
    <div class="row">
      <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
        <ul class="list-inline text-center footer-links">
          
          
        </ul>
        <p class="credits copyright text-muted">
        &copy;2017-2018
          
          &nbsp;&bull;&nbsp;
          September 20,2019
          updated
          
            &nbsp;&bull;&nbsp;
            <a href="https://systemime.github.io">Home</a>
          
        </p>

        <p class="credits theme-by text-muted">
        <a href="https://servicemesher.github.io" target="_blank">ServiceMesher</a>&nbsp;&bull;&nbsp;<a href="https://github.com/yangchuansheng/k8s-knowledge" target="_blank">Kubernetes 知识图谱</a>
        <br />
        <span id="busuanzi_container_site_pv">
            本站已被访问 <span id="busuanzi_value_site_pv"></span> 次啦
        </span>
        <span id="busuanzi_container_site_uv">
            &ensp;|&ensp;&thinsp;您是第 <span id="busuanzi_value_site_uv"></span> 位到访的小伙伴喔
        </span>
        </p>
        
        <p class="credits theme-by text-muted">
          <a href="http://gohugo.io">Hugo v0.67.0</a> powered &nbsp;&bull;&nbsp; Theme by <a href="http://deanattali.com/beautiful-jekyll/">Beautiful Jekyll</a> adapted to <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a>
          
          <center><section class="credits theme-by text-muted">
    <span class="footer__copyright">
    <div>
    <span id="span_dt_dt"> </span>
    <script language="javascript">
      function show_date_time(){
        window.setTimeout("show_date_time()", 1000);
        BirthDay=new Date("7/8/2017 10:56:12");
        today=new Date();
        timeold=(today.getTime()-BirthDay.getTime());
        sectimeold=timeold/1000
        secondsold=Math.floor(sectimeold);
        msPerDay=24*60*60*1000
        e_daysold=timeold/msPerDay
        daysold=Math.floor(e_daysold);
        e_hrsold=(e_daysold-daysold)*24;
        hrsold=Math.floor(e_hrsold);
        e_minsold=(e_hrsold-hrsold)*60;
        minsold=Math.floor((e_hrsold-hrsold)*60);
        seconds=Math.floor((e_minsold-minsold)*60);
        span_dt_dt.innerHTML="本博客已经开心运行 "+daysold+" 天 "+hrsold+" 小时 "+minsold+" 分 "+seconds+" 秒";
      }
      show_date_time();
    </script>
    </div>
</script>
</section>
</center>
        </p>
      </div>
    </div>
  </div>
</footer>


<script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/bootstrap.min.js"></script>
<script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/photoswipe-ui-default.min.js"></script>
<script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/photoswipe.min.js"></script>
<script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/auto-render.min.js"></script>
<script src="https://systemime.github.io/js/main.js"></script>
<script src="https://systemime.github.io/js/clipboard.min.js"></script>
<script src="https://systemime.github.io/js/prism.js?t=123"></script>
<script src="https://systemime.github.io/js/highlight.min.js"></script>
<script src="https://res.cloudinary.com/jimmysong/raw/upload/rootsongjc-hugo/katex.min.js"></script>
<script src="https://systemime.github.io/js/reward.js"></script>
<script src="https://systemime.github.io/js/canvas_ribbon.js"></script>
<script> renderMathInElement(document.body); </script>

<script src="https://systemime.github.io/js/baguetteBox.js"></script>
<script> baguetteBox.run('.gallery');</script>






<script async defer src="https://buttons.github.io/buttons.js"></script>


<script src="https://polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>
<script type="text/javascript" src="https://systemime.github.io/js/quicklink.umd.js"></script>
<script>
window.addEventListener('load', () =>{
   quicklink();
});
</script>



<script type="text/javascript">
 
var a_idx = 0;
jQuery(document).ready(function($) {
    $("body").click(function(e) {
        var a = new Array("Docker", "Kubernetes", "Prometheus", "Envoy", "Istio", "Service Mesh", "Cloud Native");
        var $i = $("<span />").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        function randomColor() {
          var flakeColor = new Array("#FFDA65", "#00BFFF", "#BA55D3", "#FFA07A", "#87CEEB", "#FFB6C1");
          var snowColor = flakeColor[Math.floor(flakeColor.length * Math.random())];
          return snowColor;
        }
        $i.css({
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": randomColor()
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});
</script>


<script type="text/javascript" src="https://systemime.github.io/js/lightbox.js"></script>











<script src="https://cdn.plyr.io/3.4.7/plyr.js"></script>
<script>const player = new Plyr('#player');</script>


<script async defer src="https://buttons.github.io/buttons.js"></script>


  </body>
</html>

